<?php
/**
 * Created by PhpStorm.
 * User: yu
 * Date: 2017/1/5
 * Time: 下午4:44
 */

namespace Common\Model;
use Think\Model;

class BaseModel extends Model
{
	public function store($data){

		if($this->create($data)){
			$action = isset($data[$this->pk]) ? 'save' : 'add';
			$re = $this->$action($data);
			return ['status'=>'success','message'=>'成功','data'=>$re];
		}
		return ['status'=>'error','message'=>'失败'];
	}
}